package com.emoriarty.android.outilsresources.common;

import com.emoriarty.android.outilsresources.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class PlanetsAdapter extends ArrayAdapter<String> {
	private int layout;

	public PlanetsAdapter(Context context, String[] planets) {
		super(context, R.layout.overlap_menu_list_item, planets);
		
		this.layout = R.layout.overlap_menu_list_item;
	}
	
	public PlanetsAdapter(Context context, String[] planets, int layout) {
		super(context, layout, planets);
		this.layout = layout;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(layout, parent, false);
		}
		
		((TextView) convertView.findViewById(android.R.id.text1)).setText(getItem(position));
		
		return convertView;
	}
}
